#include <stdio.h>

int main()
{
	FILE *fp;
	int counter=0,total,l;
	char a[327]; 
	fp=fopen("stdu.csv","w");
	printf("Please enter the students' number and their scores:"); 
	printf("(If you want to stop enterting,press ctrl+c.)");
	while(1)
	{
		total=0;
		scanf("%11s",a);
		printf("%s\n",a);
		if(a[0]=='\0')
		break;
		fwrite(a,11,1,fp);
		fprintf(fp,",");
		for(int i=0;i<3;i++)
		{
			int score;
			scanf("%d",&score);
			if(i<3)
			{
				scanf("%c",a);
			}
		    total+=score;
		    fprintf(fp,"%d,",score);
		}
		fprintf(fp,"%d\n",total/3);
		fflush(fp);	
	}
	fclose(fp);
	return 0;
} 
